package edu.zut.main.thread;

public class ThreadPriority {

    public static void main(String[] args) {

        //线程的优先级   默认都是5
        Thread thread = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "执行");
        }, "线程A");
        Thread thread2 = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "执行");
        }, "线程B");
        //线程优先级设定
        thread.setPriority(8);
        thread2.setPriority(7);
        thread.start();
        thread2.start();



    }

}
